﻿@page
@model IndexModel
@{
    ViewData["Title"] = "Home page";
}

<div class="text-center">
    <h1 class="display-4">Welcome</h1>
    <p>Learn about <a href="https://docs.microsoft.com/aspnet/core">building Web apps with ASP.NET Core</a>.</p>
</div>
<form>
    <p>
        Title: <input type="text" asp-for="Speektext" />
        <input type="submit" value="生成语音" />
    </p>
</form>
<audio style="width:350px;height:50px;" id="bofang" controls><source src="@Model.filename" type="audio/mpeg"></audio>
<input type="button" id="aa" value="播放" onclick="bofang()" />
   <script type="text/javascript">
        function bofang() {
            var url = "@Model.filename.Replace("\\","\\\\")";
            var audio = document.getElementById('bofang');
                    $('#bofang').attr('src',url);
                    audio.play();
                }
    </script>